import { createRouter, createWebHashHistory } from "vue-router";
import Home from "../components/Home.vue";
const routes = [
  {
    name: "home", //路由名称
    path: "/", //路由匹配的路径,"/"表示根路径
    component: Home, //匹配Home组件,注意需要导入
    redirect: "/welcome", //重定向到欢迎页
    meta: { title: "首页" }, //定义元数据,将来用得上,比如对应的标题
    children: [
      {
        name: "Welcome", //路由名称
        path: "/welcome", //路由匹配的路径,"/"表示根路径
        component: () => import("../components/Welcome.vue"),
      },
      {
        name: "ShopInfo",
        path: "/shop-op1",
        component: () => import("../components/shop/ShopInfo.vue"),
        meta: { title: "店铺信息" },
      },
      {
        name: "IncomingManagement",
        path: "/shop-op2",
        redirect: "/shop-op2/0",
        component: () => import("../components/shop/IncomingManagement.vue"),
        meta: { title: "进件管理" },
        children: [
          {
            name: "index1",
            path: "/shop-op2/0",
            component: () =>
              import("../components/shop/IncomingManagement/index1.vue"),
          },
          {
            name: "index2",
            path: "/shop-op2/1",
            component: () =>
              import("../components/shop/IncomingManagement/index2.vue"),
          },
          {
            name: "index3",
            path: "/shop-op2/2",
            component: () =>
              import("../components/shop/IncomingManagement/index3.vue"),
          },
          {
            name: "index4",
            path: "/shop-op2/3",
            component: () =>
              import("../components/shop/IncomingManagement/index4.vue"),
          },
          {
            name: "index5",
            path: "/shop-op2/4",
            component: () =>
              import("../components/shop/IncomingManagement/index5.vue"),
          },
          {
            name: "index6",
            path: "/shop-op2/5",
            component: () =>
              import("../components/shop/IncomingManagement/finish.vue"),
          },
        ],
      },
      {
        name: "PaySetting",
        path: "/shop-op3",
        component: () => import("../components/shop/PaySetting.vue"),
        meta: { title: "支付设置" },
      },
      {
        name: "BusinessSetting",
        path: "/shop-op4",
        component: () => import("../components/shop/BusinessSetting.vue"),
        meta: { title: "业务设置" },
      },
      {
        name: "AssociationSetting",
        path: "/shop-op5",
        component: () => import("../components/shop/AssociationSetting.vue"),
        meta: { title: "关联设置" },
      },
      {
        name: "Ordersetting",
        path: "/shop-op6",
        component: () => import("../components/shop/Ordersetting.vue"),
        meta: { title: "点单设置" },
      },
      {
        name: "commoditySetting",
        path: "/commodity",
        redirect: "/commodity/productLibrary",
        meta: { title: "商品管理" },
        children: [
          {
            name: "ProductLibrary",
            path: "/commodity/productLibrary",
            component: () =>
              import("../components/commodity/ProductLibrary.vue"),
            meta: { title: "商品库" },
          },
        ],
      },
      {
        name: "Vip",
        path: "/vip",
        component: () => import("../components/vip/Vip.vue"),
        meta: { title: "会员中心" },
      },
      {
        name: "Property",
        path: "/property",
        component: () => import("../components/property/Property.vue"),
        meta: { title: "资产管理" },
      },
    ],
  },
  {
    name: "Login",
    path: "/login",
    component: () => import("../views/Login.vue"),
    meta: { title: "登录页" },
  },
  {
    name: "error",
    path: "/:catchAll(.*)",
    component: () => import("../views/error/index.vue"),
    meta: { title: "错误" },
  },
];

export default createRouter({
  history: createWebHashHistory(),
  routes: routes,
});
